import { createStore } from "vuex";
import getters from './getters';

export default createStore({
	state: {
		isPay: false,
		payAmount: 10,
		transition: 'slide-left',
		userList: []
	},
	mutations: {
		SET_RULES(state,rules){
			state.isPay = rules.isPay;
			state.userList = rules.userList;
			state.payAmount = rules.payAmount;
		},
		SET_TRANSITION(state,transition){
			state.transition = transition;
		}
	},
	actions: {
		setRules({ commit },rules){
			return new Promise((resolve, reject) => {
				commit('SET_RULES',rules);
				resolve();
			})
		},
		setTransition({ commit },transition){
			return new Promise((resolve, reject) => {
				commit('SET_TRANSITION',transition);
				resolve();
			})
		}
	},
	getters,
	modules: {},
});
